package jmine.tec.executionlog.dao;

import java.util.List;

import jmine.tec.executionlog.domain.ExecutionConsoleLog;

import org.hibernate.Criteria;

import bancosys.tec.persist.dao.BaseDAO;
import bancosys.tec.persist.hibernate.RestrictionsUtils;
import bancosys.tec.utils.date.Timestamp;

/**
 * DAO de log de execução de console.
 * 
 * @author diego.ferreira
 * @created Jul 15, 2010
 */
public class ExecutionConsoleLogDAO extends BaseDAO<ExecutionConsoleLog> {

    /**
     * Encontra execucoes para o intervalo de tempo informado.
     * 
     * @param startTime Inicio (Timestamp).
     * @param endTime Fim (Timestamp).
     * @return Lista de log de execução de console.
     */
    public List<ExecutionConsoleLog> findByPeriod(Timestamp startTime, Timestamp endTime) {

        Criteria criteria = this.createCriteria();

        RestrictionsUtils.addRestrictionGe(criteria, "executionStartTime", startTime);

        RestrictionsUtils.addRestrictionLe(criteria, "executionEndTime", endTime);

        return this.executeQuery(criteria);
    }
}
